from lib import initFile
from lib import search_keyword
#from lib import crawl


def main():
    
    #initdbSQL
    #initBloomFilter()
    print("Please input the keywords list file's name:")
    fileName = input()
    #打开文件并将其转为list且打印
    kwList = initFile(fileName)#.splitlines()
    
    '''
    print("Read file completed,%3d"% len(kwList)+" key words:")
    for i in range(0,len(kwList)):
        print("%14s"% kwList[i],end="")
        if i == len(kwList) - 1:
            print("\n")
    '''
    
    #开始爬取
    print("Now crwal work start")
    for i in range(0,len(kwList)):
        search_keyword(kwList[i])
    #disconnectDB()
    #结束爬取，提示
    #print("%d crwal work done."% len(kwList))

if __name__ == '__main__':
    #判断以何形式加载
    main()